import { IRouteComponentProps } from 'umi'
import React,{FC, useEffect, useState} from 'react'
import Management from './management';
import { getCookie } from '@/utils/auth';
// import '../global.less'
const Layout:React.FC<IRouteComponentProps> = (props) => {
    let [isMobile,setisMobile]=useState(false);

useEffect(() => {
   let handleResize=()=>{
       if(window.innerWidth<992){
           setisMobile(true)
       }else{
        setisMobile(false)
       }
   }
   window.addEventListener('resize',handleResize);
   return ()=>{
       window.removeEventListener('resize',handleResize);
}
}, [])
if(isMobile){
return <h1>请在PC端打开</h1>
}

let content = props.children;
   if(getCookie()){
           content = <Management>{props.children}</Management>
   }else{
       return content
   }
    return <div className='box-father'>
                <div className='layout_pc'>
                    {content}
                </div>
            </div>
}
export default Layout

